home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PCTV3N3 / 386OPS.ASM next >
Assembly Source File  |  1992-06-12  |  1KB  |  45 lines

  1.       public LongMul386,LongDivMod386,LongShr386,LongShl386,TailPtr
  2.  
  3. Code    segment  byte public 'code'
  4.         assume   cs:Code, ds:Code, ss:Code, es:Code
  5.         .386p
  6.         ideal
  7. proc    LongMul386      far
  8.         xchg    ax,dx          ; Swap high and low words
  9.         rol     eax,16         ; Move high word to top of register
  10.         mov     ax,dx          ; eax := dx:ax
  11.         xchg    cx,bx
  12.         rol     ecx,16
  13.         mov     cx,bx          ; ecx := bx:cx
  14.         imul    ecx
  15.         shld    edx,eax,16     ; dx:ax := eax
  16.         ret
  17. endp
  18. proc    LongDivMod386   far
  19.         xchg    ax,dx          ; Swap high and low words
  20.         rol     eax,16         ; Move high word to top of register
  21.         mov     ax,dx          ; eax := dx:ax
  22.         cdq                    ; Sign extend!
  23.         xchg    cx,bx
  24.         rol     ecx,16
  25.         mov     cx,bx          ; ecx := bx:cx
  26.         idiv    ecx            ; edx:eax := eax mod/div ecx
  27.         mov     ecx,edx        ; The modulus
  28.         shld    edx,eax,16     ; dx:ax := eax {quotient}
  29.         shld    ebx,ecx,16     ; bx:cx := ecx {modulus}
  30.         ret
  31. endp
  32. proc    LongShr386      far
  33.         shrd    ax,dx,cl
  34.         shr     dx,cl
  35.         ret
  36. endp
  37. proc    LongShl386      far
  38.         shld    dx,ax,cl
  39.         shl     ax,cl
  40.         ret
  41. endp
  42. TailPtr:
  43.         ends
  44.         end
  45.